home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagn_r.zip / NETWORK.SWG / 0004_GET-ID3.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  3KB  |  98 lines

  1. {
  2. [   Does anyone know the syntax For Novell-specific interrupts in Pascal
  3. [(or C)?  I have posted this message in all the pascal confs nad haven't
  4. [had any replies.  Any help is appreciated.
  5. [  Specifically, I need to use interrupts to find the username, security
  6. [in a certain directory and groups belongs to.
  7.  
  8. Since this is Novell-specific I hope the moderator won't mind if I
  9. answer this one in this conference, rather than Pascal conf...
  10.  
  11. You Absolutely NEED a copy of "System Calls - Dos" from Novell. This
  12. book has every last call you'll ever need For getting inFormation out of
  13. NetWare. Warning: some of their inFormation is erroneous, and you'll
  14. just have to do things like count up the size of the Reply buffers, For
  15. example, and not trust their reported Record sizes.
  16.  
  17. Just as an example of how to use the inFormation from the System Calls
  18. book, here's an example of a Function I slapped together to return a
  19. 3-Character username. Pretty much all the Novell calls work the same
  20. way: you set up a Request buffer and a Reply buffer, then you read your
  21. results into whatever Format you want them. Hope this helps:
  22. }
  23.  
  24. Function GetNetUserID:String;
  25. Var
  26.   NovRegs:Registers;
  27.   Answer:String[3];
  28.   iii:Integer;
  29.   ConnectNo:Byte;
  30.   Request   : Record
  31.                 Len    : Word;                    {LO-HI}
  32.                 SubF   : Byte;
  33.                 ConnNum: Word;                    {HI-LO}
  34.               end;
  35.   Reply     : Record
  36.                 Len    : Word;                    {LO-HI}
  37.                 ObjID  : LongInt;                 {HI-LO}
  38.                 ObjType: Word;
  39.                 ObjName: Array[1..48] of Byte;
  40.                 LogTime: Array[1..7] of Byte;
  41.               end;
  42. begin
  43.   if (ReqdNetType <> Novell) then
  44.     GetNetUserID := copy(ParamStr(2),1,3);
  45.   if (ReqdNetType = Novell) then
  46.  
  47.   begin
  48.  
  49.     With NovRegs do
  50.     begin
  51.       AH := $dc;
  52.       AL := $00;
  53.       cx := $0000;
  54.     end;
  55.  
  56.     MsDos(NovRegs);
  57.     ConnectNo:=NovRegs.AL;
  58.  
  59.     For iii := 1 to 48 do
  60.     begin
  61.       Reply.ObjName[iii] := $00;
  62.     end;
  63.  
  64.     With Request do
  65.     begin
  66.       Len    := Sizeof(Request) - 2;
  67.       SubF   := $16;
  68.       ConnNum:= (ConnectNo);
  69.     end;
  70.  
  71.     Reply.Len := Sizeof(Reply) - 2;
  72.  
  73.     With NovRegs do
  74.     begin
  75.       AH := $e3;
  76.       DS := Seg(Request);
  77.       SI := ofs(Request);
  78.       ES := Seg(Reply);
  79.       DI := ofs(Reply);
  80.     end;
  81.  
  82.     MsDos(NovRegs);
  83.     Answer:='   ';
  84.  
  85.     For iii:= 1 to 3 do
  86.     begin
  87.       Answer[iii]:= chr(Reply.ObjName[iii]);
  88.     end;
  89.  
  90.     GetNetUserID:= Answer;
  91.   end;
  92. end; {GetNetUserID}
  93.  
  94. {
  95. That $e3 in the AH register is the generic bindery call. $16 is the
  96. subFunction For "Get Connection Name" in the Bindery calls.
  97. }
  98.